package jpsProject1;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * 
 * @author s0ereN
 *
 */
public class Controller extends Thread {
    
    private Observer oS; //Observer 
    private View view;
    

    private ThreadPoolExecutor threadPool;
    private int poolSize = 6;
    private int maxPoolSize = 6;
    private long keepAliveTime = 10;
    private final ArrayBlockingQueue<Runnable> queue = new ArrayBlockingQueue<Runnable>(5);
    
    // Constructor
    Controller(){
        this.threadPool = new ThreadPoolExecutor(poolSize, maxPoolSize, keepAliveTime, TimeUnit.SECONDS, queue);
        view = new View();        
    }
    
    public void startObserver(){
//        oS = new Observer(view.getwFolder(), view.getwFolder2(), view.getfFolder(), view.getoFolder(), view.getbFolder(), view.getBatch(), view);
        oS = new Observer(view.getwFolder(), view.getfFolder(), view.getoFolder(), view.getbFolder(), view.getBatch(), view);
        threadPool.submit(oS);
    }
    public View getView() {
        return view;
    }
    
    
}
